﻿// Copyright (c) 2014 Bryan C. O'Connell
// http://wsubi.codeplex.com/license
// Purpose: ResultSet is returned by all objects implementing ICommand when Execute() runs, 
// and stores data and presentation information to be delivered to the user.

using System;
using System.Collections.Generic;
using Wsubi.Code.Utilities;

namespace Wsubi.Code.Commands
{
    public enum OutputsTo { File, Screen }    

    public class ResultSet
    {
        private List<string> _Results;

        public OutputsTo OutputTo { get; set; }

        public ResultSet()
        {
            _Results = new List<string>();
            OutputTo = OutputsTo.Screen;
        }

        public void SortResults()
        {
            _Results.Sort();
        }

        public void AddResult(string NewResult)
        {
            Guard.CheckForEmptyString(NewResult);
            _Results.Add(NewResult);
        }

        public void SaveResults(List<string> ResultsToSave)
        {
            _Results = ResultsToSave;
        }

        public List<string> GetResults()
        { 
            if (_Results.Count == 0) {
                _Results.Add("No results were found.");
            }

            return _Results;
        }
    }
}
